<!-- 今日新增 -->
<template>
    <view>
      <!--  <status-bar title='今日新增' :goHome='fromShare'></status-bar> -->
        <view class="padding30">
            <view class="card bgwhite bor_radius_6 padding30">
                <view class="size34 color_11 bold">新增曲线</view>
                <line :raw-data="lineData"></line>
            </view>
            <view>
                <view class="size30 color_44 bold text-center m-top40 m-bot40">今日新增地区比</view>
                <ring :raw-data="ringData"></ring>
            </view>
            <view>
                <view class="d-flex j-sb a-center m-top50 m-bot50">
                    <view class="size34 color_11 bold">新增客户</view>
                    <view @click="toUrl('/privatePage/client/myClient')">
                        <text class="size26 color_66 m-right10">全部</text>
                        <text class="iconfont icon-xiangyouxiayiye color_99"></text>
                    </view>
                </view>
                <view v-if="list.length">
                    <view class="d-flex j-sb a-center m-bot30" v-for="(item,index) in list" :key="index" @click="toUrl('/privatePage/client/detail?guest_id=' + item.v_id)">
                        <view class="d-flex">
                            <u-avatar :src="$imgUrls(item.v_headimg)" size="40"></u-avatar>
                            <view class="m-left20">
                                <view class="size30 color_11 m-bot6">{{ item.v_name }}</view>
                                <view class="size28 color_44">{{ item.v_tel }}</view>
                            </view>
                        </view>
                        <view class="text-right">
                            <view class="size22 color_66 m-bot6">注册时间</view>
                            <view class="size30 color_44">{{ item.v_addtime }}</view>
                        </view>
                    </view>
                </view>
                <emptys v-else></emptys>
            </view>
        </view>
    </view>
</template>

<script>
import line from '../components/line'
import ring from '../components/ring'
export default {
    data(){
        return {
            fromShare: 0,
            lineData: {},
            ringData: {},
            list: []
        }
    },
    components: {
        line,
        ring
    },
    onLoad(){
        this.getLineData()
        this.getRingData()
        this.getList()
    },
    methods: {
        getLineData(){
            this.$http.get({
                url: '/DiyApi/getStatisticsThisDay',
                data: {
                    type: 'member',
                    is_private: 1
                }
            }).then(res=>{
                if(res.code != 200) return this.$Toast(res.msg)
                this.lineData = res.data
            })
        },
        getRingData(){
            this.$http.get({
                url: '/DiyApi/pieChart',
                data: {
                    type: 'member',
                    display_mode: 'area',
                    is_private: 1
                }
            }).then(res=>{
                if(res.code != 200) return this.$Toast(res.msg)
                this.ringData = res.data
            })
        },
        getList(){
            this.$http.get({
                url: '/PrivateSphereApi/todayInc',
                data: {
                    type: 'member',
                    is_private: 1
                }
            }).then(res=>{
                if(res.code != 200) return this.$Toast(res.msg)
                this.list = res.data || []
            })
        }
    }
}
</script>

<style lang="scss" scoped>
.card {    
    border: 1px solid #DCDCDC;
}
</style>